package com.demo.index;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import com.jfinal.core.Controller;
import com.jfinal.upload.UploadFile;

/**
 * 本 demo 仅表达最为粗浅的 jfinal 用法，更为有价值的实用的企业级用法
 * 详见 JFinal 俱乐部: http://jfinal.com/club
 * 
 * IndexController
 */
public class IndexController extends Controller {
	public void index() {
		render("index.html");
	}
	public void upload(){
		Map<String,String> map = new HashMap<String,String>();
		UploadFile file = getFile("file");
		String para = getPara("para");
		map.put("msg", "文件名："+file.getFileName()+"；参数："+para);
		System.out.println(file.getUploadPath());
		File delfile = new File(file.getUploadPath()+"\\"+file.getFileName());
		if (delfile.isFile() && delfile.exists()) {  
			delfile.delete();
	    }  
		renderJson(map);
	}
}